// history模式
import {
    createRouter,
    createWebHashHistory,
} from 'vue-router'

import Login from '../views/login/index.vue'
import Home from '../views/home/index.vue'
import Pur from '../views/pur/index.vue'
import Sale from '../views/sale/index.vue'
import Stock from '../views/stock/index.vue'

const routes = [
// 路由的默认路径
    {
        path:'/',
        redirect:"/login"
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/home',
        component: Home,
        children:[
            {
                path: '/pur',
                component: Pur
            },
            {
                path: '/sale',
                component: Sale
            },
            {
                path: '/stock',
                component: Stock
            },
        ]
    },

]

// 创建路由对象
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router;
